package org.jeecg.modules.app.controller;

import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.config.BaiduAipClient;
import org.jeecg.modules.app.service.BaseAppInstallService;
import org.json.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;

@RestController
@RequestMapping("/app/baseApp")
@Slf4j
@RequiredArgsConstructor
public class BaseAppController {

    private final BaseAppInstallService appInstallService;

    /**
     * 车牌识别
     *
     * @return
     */
    @PostMapping("/doCarNoOcr")
    public Result<?> doCarNoOcr(@RequestPart("file") MultipartFile file) {
        String result = appInstallService.baiduCarNoOcr(file);
        if (result == null) {
            return Result.error("车牌识别失败");
        } else {
            return Result.ok(result);
        }
    }

}
